<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="../../css/font.css" />
		<link rel="stylesheet" href="../../css/common.css" />

		<link rel="stylesheet" href="../../css/details.css" />
		<script type="text/javascript">
			document.addEventListener('plusready', function() {
				//console.log("所有plus api都应该在此事件发生后调用，否则会出现plus is undefined。"

			});
		</script>

	</head>
	<body>

		<header class=" header-module ">
			<div class="flex-justify-align header-top">
				<a href="../../safe.html" class="iconfont iconfanhuijiantou header-back"></a>
				<p class="header-title">政企通 - 产品详情</p>
				<span class="header-span">
					<!-- <button type="button" class="user-btn" onclick="window.location.href='../../submit.html?id=3'">立即提报</button> -->
					<button type="button" class="user-btn" onclick="toSubmit()">立即提报</button>
				</span>
			</div>

		</header>
		<article class="middle-moudle middle-moudle-detail">
			<section class="flex-justify-align base-interval loans-item loans-item-detail ">
				<img src="../../img/loans/loans-data-type.png" id="logo" />
				<div class="loans-info">
					<p id="productName"></p>
					<span id="inOrganization"></span>
					<span id="interestRate_div">利率：<label id="interestRate"></label></span>
					<span id="type_div">类型：<label id="type"></label></span>
				</div>
			</section>

			<section class="flex-justify-align base-interval loans-detail" id="productContent_div">
				<div class="detial-title">产品简介</div>
				<div class="detial-info" id="productContent"></div>
			</section>
			<section class="flex-justify-align base-interval loans-detail" id="productUse_div">
				<div class="detial-title">产品用途</div>
				<div class="detial-info" id="productUse"></div>
			</section>
			<section class="flex-justify-align base-interval loans-detail" id="companyLocation_div">
				<div class="detial-title">企业定位</div>
				<div class="detial-info" id="companyLocation"></div>
			</section>
			<section class="flex-justify-align base-interval loans-detail" id="productAdvantage_div">
				<div class="detial-title">产品优势</div>
				<div class="detial-info" id="productAdvantage"></div>
			</section>
			<section class="flex-justify-align base-interval loans-detail" id="productValidity_div">
				<div class="detial-title">产品期限</div>
				<div class="detial-info" id="productValidity"></div>
			</section>
			<section class="flex-justify-align base-interval loans-detail" id="process_div">
				<div class="detial-title">办理流程</div>
				<div class="detial-info" id="process"></div>
			</section>
			<section class="flex-justify-align base-interval loans-detail" id="contacter_div">
				<div class="detial-title">联系人</div>
				<div class="detial-info" id="contacter"></div>
			</section>
			<section class="flex-justify-align base-interval loans-detail" id="telphone_div">
				<div class="detial-title">联系电话</div>
				<div class="detial-info" id="telphone"></div>
			</section>



		</article>
	</body>

	<script src="../../js/jquery-3.0.0.min.js"></script>
	<script src="../../js/gloab.js"></script>
	<script>
		$(function() {
			var id = getUrlParam('id');
			loadData(id);
		});

		function toSubmit() {
			window.location.href = '../../submit3.html?id=3&iid=' + getUrlParam('id');
		};

		function loadData(id) {
			$.ajax({
				//请求方式    
				type: "GET",
				//文件位置    
				url: basePath + "app/tcompany/getOneSafeInfo",
				data: {
					"id": id
				},
				//返回数据格式为json,也可以是其他格式如    
				dataType: "json",
				//请求成功拼接html    
				success: function(data) {
					console.log(data)
					if (data.msg == 'success') {
						var insurance = data.tInsuranceEntityt;
						if (insurance.logo) {
							var logo = "../../" + insurance.logo;
							$("#logo").attr("src", logo);
						}
						for (var key in insurance) {
							hidDiv(key, insurance[key]);
						}
						if (insurance.telphone) {
							$("#telphone").html('<a id="totelphone" href="tel:' + insurance.telphone + '">' + insurance.telphone + '</a>');
							console.log(document.getElementById("totelphone"))
						}
					}
				}
			});
		}

		function hidDiv(id, value) {
			$("#" + id).html(value);
			if (value == null || value == '') {
				$("#" + id + "_div").hide();
			}
		}

		//获取url中的参数
		function getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg); //匹配目标参数
			if (r != null) return unescape(r[2]);
			return null; //返回参数值
		}
	</script>
</html>
